﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

#pragma once
#include "GmFamilyService.h"
#include "IFamilyConnector.h"
#include "ContainerUtil.h"
#include "FamilyConnectorEnums.h"

namespace gcmp
{
    class IGraphicsNodeReference;
    class IGraphicsBRepEdge;
}

namespace gfam
{
    /// \brief 三维连接件基类
    class GM_FAMILY_SERVICE_EXPORT IFamilyConnector3d : public IFamilyConnector
    {
        DEFINE_CAST_DERIVED(gfam::IFamilyConnector3d, gfam::IFamilyConnector)

    public:
        /// \brief 创建三维连接件
        ///
        /// \param pDocument 文档指针，输入为空时，创建三维连接件失败，返回nullptr
        /// \param pNodeReference 连接件引用对象
        /// \param pEdges 连接件引用对象(边的图形节点)
        /// \param pConnectorShape 连接件形状
        /// \param pConnectorType 连接件类型
        /// \return 创建成功返回三维连接件指针，创建失败返回nullptr
        static IFamilyConnector3d* Create(gcmp::IDocument* pDocument, const gcmp::IGraphicsNodeReference* pPlanFace, const gcmp::GraphicsNodeReferenceOwnerPtrVector& pEdges, const IFamilyConnectorShape *pConnectorShape, const IFamilyConnectorType *pConnectorType);

        /// \brief 创建三维连接件
        ///
        /// \param pDocument 文档指针，输入为空时，创建二维连接点失败，返回nullptr
        /// \param pNodeReference 连接件引用对象
        /// \param pEdges 连接件引用对象(边)
        /// \param pConnectorShape 连接件形状
        /// \param pConnectorType 连接件类型
        /// \return 创建成功返回三维连接件指针，创建失败返回nullptr
        static IFamilyConnector3d* Create(gcmp::IDocument* pDocument, const gcmp::IGraphicsNodeReference* pPlanFace, std::vector<const gcmp::IGraphicsBRepEdge*> pEdges, const IFamilyConnectorShape *pConnectorShape, const IFamilyConnectorType *pConnectorType);

        /// \brief 获取连接件引用对象
        ///
        /// \return 连接件引用对象
        virtual const gcmp::IGraphicsNodeReference* GetFaceReferenceObject() const = 0;

        /// \brief 设置连接件引用对象
        ///
        /// \param opFaceReferenceObject 连接件引用对象
        virtual void SetFaceReferenceObject(gcmp::OwnerPtr<gcmp::IGraphicsNodeReference> opFaceReferenceObject) = 0;

        /// \brief 获取连接件引用对象(edge)
        ///
        /// \return 连接件引用对象
        virtual const std::vector<gcmp::OwnerPtr<gcmp::IGraphicsNodeReference>>& GetFacesReferenceObjects() const = 0;

        /// \brief 设置连接件引用对象(edge)
        ///
        /// \param referenceObjects 连接件引用对象
        virtual void SetFacesReferenceObjects(std::vector<gcmp::OwnerPtr<gcmp::IGraphicsNodeReference>>& referenceObjects) = 0;

        /// \brief 获取连接件是否翻转过Y轴
        ///
        /// \return 如果连接件翻转过Y轴，返回true，否则返回false
        virtual const bool GetIsFlipY() const = 0;

        /// \brief 设置连接件是否翻转过Y轴
        ///
        /// \param isFlipedY 连接件是否翻转过Y轴
        virtual void SetIsFlipY(bool isFlipedY) = 0;

        /// \brief 获取连接件是否翻转过Z轴
        ///
        /// \return 如果连接件翻转过Z轴，返回true，否则返回false
        virtual const bool GetIsFlipZ() const = 0;

        /// \brief 设置连接件是否翻转过Z轴
        ///
        /// \param isFlipedZ 连接件是否翻转过Z轴
        virtual void SetIsFlipZ(bool isFlipedZ) = 0;

        /// \brief 获取连接件旋转角度
        ///
        /// \return 连接件旋转角度
        virtual double GetRotateAngle() const = 0;

        /// \brief 设置连接件旋转角度
        ///
        /// \param angle 连接件旋转角度
        virtual void SetRotateAngle(double angle) = 0;

        /// \brief 获取连接件是否为Primary连接点
        ///
        /// \return 如果连接件是Primary连接点，返回true，否则返回false
        virtual bool GetIsPrimary() const = 0;

        /// \brief 设置连接件是否为Primary连接点
        ///
        /// \param isPrimary 连接件是否为Primary连接点
        virtual void SetIsPrimary(bool isPrimary) = 0; 

        /// \brief 获取与之关联的连接符号的Id
        ///
        /// \return 与之关联的连接符号的Id
        virtual gcmp::ElementId GetConnectorLinkSymbolId() const = 0;

        /// \brief 设置与之关联的连接符号的Id
        ///
        /// \param symbolId 与之关联的连接符号的Id
        virtual void SetConnectorLinkSymbolId(gcmp::ElementId symbolId) = 0;

        /// \brief 获取连接件流向类型
        ///
        /// \return 连接件流向类型
        virtual FamilyConnectorFlowDirectionType GetFlowDirection() const = 0;

        /// \brief 设置连接件流向类型
        ///
        /// \param flowDirection 连接件流向类型
        virtual void SetFlowDirection(FamilyConnectorFlowDirectionType flowDirection) = 0;

        /// \brief 获取连接件角度
        ///
        /// \return 连接件角度
        virtual double GetAngle() const = 0;

        /// \brief 设置连接件角度
        ///
        /// \param angle 连接件角度
        virtual void SetAngle(double angle) = 0;

        /// \brief 获取Implementation Uid
        ///
        /// \return UniIdentity 返回ImplementationUid
        static gcmp::UniIdentity GetImplementationUid();
       
    };

} 
